void readROOT()
{
    TFile *tfile = new TFile("frame2_egde4.root");
    ofstream outdata;
    outdata.open("frame2_egde4.data",ios::binary);
    TTree *t_data = (TTree*)tfile->Get("t_data");
    Short_t data[72][72];    t_data->SetBranchAddress("data",&data);
    int numEvent;          t_data->SetBranchAddress("numEvent",&numEvent);
    int numFrame;          t_data->SetBranchAddress("numFrame",&numFrame);
    int timeYear;          t_data->SetBranchAddress("timeYear",&timeYear);
    int timeMon;           t_data->SetBranchAddress("timeMon",&timeMon);
    int timeMday;          t_data->SetBranchAddress("timeMday",&timeMday);
    int timeHour;          t_data->SetBranchAddress("timeHour",&timeHour);
    int timeMin;           t_data->SetBranchAddress("timeMin",&timeMin);
    int timeSec;           t_data->SetBranchAddress("timeSec",&timeSec);
    int timeNsec;          t_data->SetBranchAddress("timeNsec",&timeNsec);
    int peakADC;           t_data->SetBranchAddress("peakADC",&peakADC);
    double peakX;          t_data->SetBranchAddress("peakX",&peakX);
    double peakY;          t_data->SetBranchAddress("peakY",&peakY);
    int sumADC;            t_data->SetBranchAddress("sumADC",&sumADC);
    int sumHit;            t_data->SetBranchAddress("sumHit",&sumHit);
    double lenXY;          t_data->SetBranchAddress("lenXY",&lenXY);
    double ratioXY;        t_data->SetBranchAddress("ratioXY",&ratioXY);
    double BcenterX;       t_data->SetBranchAddress("BcenterX",&BcenterX);
    double BcenterY;       t_data->SetBranchAddress("BcenterY",&BcenterY);
    double lenBtoP;        t_data->SetBranchAddress("lenBtoP",&lenBtoP);
    int length;            t_data->SetBranchAddress("length",&length);
    double width;          t_data->SetBranchAddress("width",&width);
    int outline;           t_data->SetBranchAddress("outline",&outline);
    int edgeHit;           t_data->SetBranchAddress("edgeHit",&edgeHit);

    // TCanvas * c1 = new TCanvas();
    // TH2F *hist = new TH2F("events","events",72,0,72,72,0,72);
    Long64_t entries = t_data->GetEntries();
    cout << "sum : " << entries << endl;
    short tdata;
    for(Long64_t i = 0; i < entries; i ++)
    {
        t_data->GetEntry(i);
        // cout << numEvent << " " << numFrame << endl;
        // if(numEvent < 25) continue;
        for(int xx = 0; xx < 72; xx ++)
            for(int yy = 0; yy < 72; yy ++)
            {
                // cout << "data: " << data[xx][yy] << endl;
                // hist->SetBinContent(xx,yy,data[xx][yy]);
                tdata = data[xx][yy];
                if(tdata < 4) tdata = 0;
                if(xx == 0 && yy < 4) tdata = 0;
		//if(i == 2 && tdata < 0) cout << tdata << endl;
                outdata.write((char *)(&tdata), sizeof(tdata));
            }
        // hist->Draw("colz");
        // gPad->Update();
        // c1->SaveAs(Form("frame%d.jpg",i));
        // if(i > 4) break;
    }
}
